
import os
import shutil

print(os.name)
print(os.environ)
print(os.environ.get("JAVA_HOME"))

print(os.path.abspath("."))
print(os.path.join(os.path.abspath("."), 'testdir'))
os.mkdir(os.path.join(os.path.abspath("."), 'testdir'))

os.rmdir(os.path.join(os.path.abspath("."), 'testdir'))

path = os.path.split("D:\myhome\py3\day3\dir\os.py")
print(path)
path = os.path.splitext("D:\myhome\py3\day3\dir\os.py")
print(path)

# 对文件重命名:
if(os.path.exists("t.txt")):
    os.rename("t.txt","rename.txt")

if(os.path.exists("rename.txt")):
    os.remove("rename.txt")

l=[x for x in os.listdir(".") if os.path.isfile(x) and os.path.splitext(x)[1]=='.py']
print(l)
print(os.path.isfile("D:\myhome\py3\day1\sorter.py"))
